<style>
    .events-list{
        max-height: 732px !important;
    }

    #body, .h-top{
        padding-top: 0 !important;
    }

    .h-top{
        padding-bottom: 0 !important;
    }
</style>

<div id="body" class="layout">
    <div class="wrap">
        <div class="left">
            <ul class="sort-panel">
                <li class="s-text">Search events:</li>
                <li>
                    <a href="<?php echo $this->baseUrl(''); ?>">
                        <span class="first">
                            <span class="last">
                                <span class="middle">
                                    Home
                                </span>
                            </span>
                        </span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo $this->baseUrl("profile"); ?>" class="current selected">
                        <span class="first">
                            <span class="last">
                                <span class="middle">
                                    Profile
                                </span>
                            </span>
                        </span>
                    </a>
                </li>
            </ul>
            <div class="cf"></div>
            <div class="name">Welcome <strong><?php echo $this->first_name . " " . $this->last_name; ?></strong></div>
            <div class="profiles">
                <div class="infos fl">
                    <div class="infoleft fl">
                        <p>Overall <strong>Rating</strong></p>
                        <div class="rates">
                            <!--<span class="rate-star" rel="9"></span>-->
                            <?php
                                $yellow_star_count = $this->totalRating;
                                $grey_start_count = RATING_STARS_MAX - $this->totalRating;
                            ?>
                            <ul class="profile-stars">
                                <?php
                                    for ($yellow_i = $yellow_star_count; $yellow_i >= "1"; $yellow_i--)
                                    {
                                        echo '<li><img src="' . IMAGES_PATH . '/star-yellow.png" alt="stars"/></li>';
                                    }
                                    for ($grey_i = "1"; $grey_i <= $grey_start_count; $grey_i++)
                                    {
                                        echo '<li><img src="' . IMAGES_PATH . '/star-grey.png" alt="stars"/></li>';
                                    }
                                ?>
                            </ul>
                            <div class="cf"></div>
                            <p class="note"><?php echo $this->totalRating . " / " . RATING_STARS_MAX; ?> Average rating</p>
                        </div>
                        <p><br /><br /><br /></p>
                        <!--<p class="ismall"><span class="blu" style="margin-right: 6px;"><strong>Info:</strong></span><?php echo $this->user_bio; ?></p>-->
                    </div>
                    <div class="inforight fl">
                        <p>Username: <strong><?php echo $this->username; ?></strong></p>
                        <p>Date of birth: <strong><?php echo $this->date_of_birth; ?></strong></p>
                        <p>From: <strong><?php echo $this->user_location; ?></strong></p>
                        <p><br /></p>
                        <p>Published Events: <span class="blu"><strong><?php echo $this->published_events; ?></strong></span></p>
                        <p>Private: <span class="blu"><strong><?php echo $this->private_events; ?></strong></span></p>
                        <p>Public: <span class="blu"><strong><?php echo $this->public_events; ?></strong></span></p>
                        <p><br /></p>
                        <p>Attended Events: <span class="org"><?php echo $this->attended_events; ?></span></p>
                    </div>
                </div>
                <div class="avt fr">
                    <img src="<?php echo $this->member_image . "?" . time(); ?>" alt="<?php echo $this->first_name . " " . $this->last_name; ?>" />
                </div>
                <div class="cf"></div>
                <div class="change-options">
                    <ul>
                        <li class="t">Change:</li>
                        <li><a href="#pe-upload" class="showpop"><img src="<?php echo IMAGES_PATH; ?>/pupload-icon.png" alt="upload" /></a></li>
                        <li class="g"><a href="#pe-gellery" class="showpop"><img src="<?php echo IMAGES_PATH; ?>/pgallery-icon.png" alt="upload" /></a></li>
                        <li class="f"><a href="#pe-facebook" class="showpop"><img src="<?php echo IMAGES_PATH; ?>/pfb-icon.png" alt="upload" /></a></li>
                        <li class="tw"><a href="#pe-twitter" class="showpop"><img src="<?php echo IMAGES_PATH; ?>/ptwitter-icon.png" alt="upload" /></a></li>
                        <li class="l"><a href="#pe-linked" class="showpop"><img src="<?php echo IMAGES_PATH; ?>/plinkedin-icon.png" alt="upload" /></a></li>
                    </ul>
                </div>
            </div>
            <div class="cf"></div>
            <div class="tabs">
                <ul class="tab-menu">
                    <?php
                        $account_active = "active";
                        if ($this->mainTabClass == "events")
                        {
                            $account_active = "";
                            $event_active = "active";
                        }
                    ?>
                    <li class="<?php echo $event_active; ?>"><a href="#events">EVENTS</a></li>
                    <li class="<?php echo $account_active; ?>"><a href="#account">ACCOUNT</a></li>
                    <li class="rate"><a href="#ratings">RATINGS & COMMENTS</a></li>
                </ul>
                <div class="cf"></div>
            </div>
            <div class="tab-content-list">
                <div class="tabs-content active">

                    <div id="events" class="content">
                        <div class="hint">
                            <div class="left fl tab-titles">
                                <ul>
                                    <?php
                                        $created_Active = "active";
                                        if ($this->tabClass == "joined")
                                        {
                                            $joined_Active = "active";
                                            $created_Active = "";
                                            $bookmarked_Active = "";
                                        }
                                        else if ($this->tabClass == "created")
                                        {
                                            $joined_Active = "";
                                            $created_Active = "active";
                                            $bookmarked_Active = "";
                                        }
                                        else if ($this->tabClass == "bookmarked")
                                        {
                                            $joined_Active = "";
                                            $created_Active = "";
                                            $bookmarked_Active = "active";
                                        }
                                    ?>
                                    <li class="<?php echo $created_Active; ?>"><a href="#created-tab" class="blu tlink">CREATED</a></li>
                                    <li class="<?php echo $joined_Active; ?>"><a href="#joined-tab" class="blu tlink">JOINED</a></li>
                                    <li class="<?php echo $bookmarked_Active; ?>"><a href="#bookmark-tab" class="blu tlink">BOOKMARKED</a></li>
                                </ul>
                            </div>
                            <div class="fr lst-h">
                                <div class="h">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span> The more Events that you create with the ticket selling option turned on, the higher your rates go! Publish Events to earn more respect and popularity.
                                    </div>
                                </div>
                                <div class="h">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span> Add more friends, so you couild sell more tickets and earn more money.
                                    </div>
                                </div>
                                <div class="h active">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span> The more Events that you create with the ticket selling option turned on, the higher your rates go! Publish Events to earn more respect and popularity.
                                    </div>
                                </div>
                            </div>
                            <div class="cf"></div>
                        </div>

                        <?php
                            $created_Active = "active";
                            if ($this->tabClass == "joined")
                            {
                                $joined_Active = "active";
                                $created_Active = "";
                                $bookmarked_Active = "";
                            }
                            else if ($this->tabClass == "created")
                            {
                                $joined_Active = "";
                                $created_Active = "active";
                                $bookmarked_Active = "";
                            }
                            else if ($this->tabClass == "bookmarked")
                            {
                                $joined_Active = "";
                                $created_Active = "";
                                $bookmarked_Active = "active";
                            }
                        ?>

                        <div class="tab-content-list second-tab">
                            <div class="tabs-content cevent-tab <?php echo $joined_Active; ?>" id="joined-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span class="remove-background"><strong>Joined</strong> Events</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="<?php echo $this->baseUrl("profile/orderby?get_event_type=joined&sort_by=date"); ?>"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                    <li><a href="<?php echo $this->baseUrl("profile/orderby?get_event_type=joined&sort_by=group_size"); ?>"><img src="<?php echo IMAGES_PATH; ?>/o3.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>

                                <div class="events-list" style="overflow-y: hidden;height: auto;">
                                    <?php
                                        $__counter = 0;
                                        if (!empty($this->joinedEvents))
                                        {

                                            foreach ($this->joinedEvents as $j_key => $j_value)
                                            {
                                                $event_id = $j_value["event_id"];
                                                $event_title = stripslashes($j_value["event_title"]);
                                                $event_images = getEventImages($event_id);

                                                $event_url = $this->baseUrl("eventdetail/" . getEncryptedString($event_id));
                                                $event_date = getEventDate($j_value["event_date"]);
                                                $event_time = date("g:i a", strtotime($j_value["event_time"]));

                                                if ($__counter == 0 || $__counter % 7 == 0)
                                                {
                                                    if ($__counter != 0)
                                                        echo "</div>";

                                                    echo "<div class='joined_page " . ($__counter == 0 ? 'active' : '') . "' id='joined-page-" . (ceil($__counter / 7) + 1) . "'>";
                                                }
                                                ?>
                                                <div class="event" id="joined-<?php echo $event_id; ?>">
                                                    <div class="ewrap">
                                                        <div class="pimg fl">
                                                            <img src="<?php echo $event_images[0]; ?>" alt="<?php echo $event_title; ?>">
                                                        </div>
                                                        <div class="details fl">
                                                            <div class="e-title">
                                                                <a class="p-name tlink" href="<?php echo $event_url; ?>"><?php echo $event_title; ?></a>
                                                                <span class="p-cates" style="vertical-align:top;">
                                                                    <span>in</span> <a href="<?php echo $this->baseUrl("event/search?cat_search=" . $j_value['category_id']); ?>" class="org tlink"><?php echo $j_value["category_name"]; ?></a> / <a class="org tlink" href="<?php echo $this->baseUrl("event/search?subcat_search=" . $j_value['subcategory_id']); ?>"><?php echo $j_value["subcategory_name"]; ?></a>
                                                                </span>
                                                                <span class="p-time"><?php echo $event_date . " / " . $event_time; ?></span>
                                                            </div>
                                                            <div class="infos">
                                                                <span class="group">Group size</span><span><?php echo $j_value["event_group_size"]; ?></span>
                                                                <span>/</span><span class="org">Address</span><span><?php echo $j_value["event_address"]; ?></span>
                                                                <span class="publish fr blu"><a href="#"><?php echo ucwords($j_value["event_type"]); ?></a></span>
                                                                <div class="cf"></div>
                                                                <div class="desc fl">
                                                                    <?php echo stripslashes($j_value["event_info"]); ?>
                                                                </div>
                                                                <div class="fr view">
                                                                    <a class="rbox orgbutton fr leave-joined" rel="joined-<?php echo $event_id; ?>" href="<?php echo $this->baseUrl("event/leaveevent?enc_event_id=" . getEncryptedString($event_id)); ?>"><strong>Leave</strong></a>
                                                                </div>
                                                                <div class="cf"></div>
                                                            </div>
                                                        </div>
                                                        <div class="cf"></div>
                                                    </div>
                                                </div>
                                                <?php
                                                if (count($this->joinedEvents) - 1 == $j_key)
                                                {
                                                    echo "</div>";
                                                }
                                                $__counter++;
                                            }
                                        }
                                        else
                                        {
                                            echo '<p style="padding:10px; font-size: 12px;">No joined events</p>';
                                        }
                                    ?>
                                </div>
                                <?php
//                                    if ($__counter != 0):
                                    if ($__counter > 7):
                                        ?>
                                        <!-- Pagination code for created event tab--->
                                        <div class="bottom-main">
                                            <div class="text">You are here:</div>
                                            <ul class="paging client-side joined" data-context ="joined">
                                                <li class="np" data-href="#prev"><a href="#prev">&lt; Prev.</a></li>
                                                <li class="current" data-href="#joined-page-1">
                                                    <span class="first">
                                                        <span class="last">
                                                            <span class="middle">
                                                                Page 1
                                                            </span>
                                                        </span>
                                                    </span>
                                                </li>
                                                <?php
                                                for ($_i = 1; $_i <= ceil($__counter / 7); $_i++)
                                                {

                                                    if ($_i == 1)
                                                        continue;
                                                    ?>
                                                    <li data-href="#joined-page-<?= $_i ?>"><a id="joined-anchor-<?= $_i ?>" href="#joined-page-<?= $_i ?>"><?= $_i ?></a></li>

                                                    <?php
                                                }
                                                ?>
                                                <li class="np" data-href="#next"><a href="#next">Next &gt;</a></li>
                                            </ul>
                                            <div class="cf"></div>
                                        </div>

                                        <!-- pagination ends -->
                                        <?php
                                    endif;
                                ?>
                            </div>
                            <div class="tabs-content cevent-tab <?php echo $created_Active; ?>" id="created-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span class="remove-background"><strong>Created</strong> Events</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="<?php echo $this->baseUrl("profile/orderby?get_event_type=created&sort_by=date"); ?>"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                    <li><a href="<?php echo $this->baseUrl("profile/orderby?get_event_type=created&sort_by=group_size"); ?>"><img src="<?php echo IMAGES_PATH; ?>/o3.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>
                                <div class="events-list" style="height: auto; overflow: hidden;">
                                    <?php
                                        $__counter = 0;
                                        if (!empty($this->createdEvents))
                                        {

                                            foreach ($this->createdEvents as $c_key => $c_value)
                                            {
                                                $event_id = $c_value["event_id"];
                                                $event_title = stripslashes($c_value["event_title"]);
                                                $event_images = getEventImages($event_id);

                                                $event_url = $this->baseUrl("eventdetail/" . getEncryptedString($event_id));
                                                $event_date = getEventDate($c_value["event_date"]);
                                                $event_time = date("g:i a", strtotime($c_value["event_time"]));


                                                if ($__counter == 0 || $__counter % 7 == 0)
                                                {
                                                    if ($__counter != 0)
                                                        echo "</div>";

                                                    echo "<div class='created_page " . ($__counter == 0 ? 'active' : '') . "' id='created-page-" . (ceil($__counter / 7) + 1) . "'>";
                                                }
                                                ?>
                                                <div class="event" id="event-<?php echo $event_id; ?>" >
                                                    <div class="ewrap">
                                                        <div class="pimg fl">
                                                            <img src="<?php echo $event_images[0]; ?>" alt="<?php echo $event_title; ?>">
                                                        </div>
                                                        <div class="details fl">
                                                            <div class="e-title">
                                                                <a class="p-name tlink clearfix" href="<?php echo $event_url; ?>" style="float:left;margin-right:5px;"><?php echo $event_title; ?></a>
                                                                <span class="p-cates">
                                                                    <span>in</span> <a href="<?php echo $this->baseUrl("event/search?cat_search=" . $c_value['category_id']); ?>" class="org tlink"><?php echo $c_value["category_name"]; ?></a> / <a class="org tlink" href="<?php echo $this->baseUrl("event/search?subcat_search=" . $c_value['subcategory_id']); ?>"><?php echo $c_value["subcategory_name"]; ?></a>
                                                                </span>
                                                                <span class="p-time"><?php echo $event_date . " / " . $event_time; ?></span>
                                                            </div>
                                                            <div class="infos">
                                                                <span class="group">Group size</span><span><?php echo $c_value["event_group_size"]; ?></span>
                                                                <span>/</span><span class="org">Address</span><span><?php echo $c_value["event_address"]; ?></span>
                                                                <span class="publish fr blu"><a href="#"><?php echo ucwords($c_value["event_type"]); ?></a></span>
                                                                <div class="cf"></div>
                                                                <div class="desc fl">
                                                                    <?php echo stripslashes($c_value["event_info"]); ?>
                                                                </div>
                                                                <div class="fr view">                                                                   
                                                                    <a class="rbox orgbutton fr" href="<?php echo $this->baseUrl("event/index/id/" . $c_value["event_id"]); ?>"><strong>Edit</strong></a>
                                                                    <a class="rbox orgbutton fr delete-event" rel="<?php echo "event-" . $event_id; ?>" href="<?php echo $this->baseUrl("event/deleteevent?event_id=" . $c_value["event_id"]); ?>"><strong>Delete</strong></a>
                                                                </div>
                                                                <div class="cf"></div>

                                                                <!--                                                                <div class="fr view">
                                                                                                                                    <a class="rbox orgbutton fr delete-event" rel="<?php echo "event-" . $event_id; ?>" href="<?php echo $this->baseUrl("event/deleteevent?event_id=" . $c_value["event_id"]); ?>"><strong>Delete</strong></a>
                                                                                                                                </div>-->
                                                                <div class="cf"></div>
                                                            </div>
                                                        </div>
                                                        <div class="cf"></div>
                                                    </div>
                                                </div>
                                                <?php
                                                if (count($this->createdEvents) - 1 == $c_key)
                                                {
                                                    echo "</div>";
                                                }
                                                $__counter++;
                                            }
                                        }
                                        else
                                        {
                                            echo '<p style="padding:10px;  font-size: 12px;">No created events</p>';
                                        }
                                    ?>
                                </div>
                                <?php
//                                    if ($__counter != 0):
                                    if ($__counter > 7):
                                        ?>
                                        <!-- Pagination code for created event tab--->
                                        <div class="bottom-main">
                                            <div class="text">You are here:</div>
                                            <ul class="paging created client-side" data-context ="created">
                                                <li class="np" data-href="#prev"><a href="#prev">&lt; Prev.</a></li>
                                                <li class="current" data-href="#created-page-1">
                                                    <span class="first">
                                                        <span class="last">
                                                            <span class="middle">
                                                                Page 1
                                                            </span>
                                                        </span>
                                                    </span>
                                                </li>
                                                <?php
                                                for ($_i = 1; $_i <= ceil($__counter / 7); $_i++)
                                                {

                                                    if ($_i == 1)
                                                        continue;
                                                    ?>
                                                    <li data-href="#created-page-<?= $_i ?>"><a id="created-anchor-<?= $_i ?>" href="#created-page-<?= $_i ?>"><?= $_i ?></a></li>

                                                    <?php
                                                }
                                                ?>
                                                <li class="np" data-href="#next"><a href="#next">Next &gt;</a></li>
                                            </ul>
                                            <div class="cf"></div>
                                        </div>

                                        <!-- pagination ends -->
                                        <?php
                                    endif;
                                ?>
                            </div>
                            <div class="tabs-content <?php echo $bookmarked_Active; ?>" id="bookmark-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span class="remove-background"><strong>Bookmarked</strong> Events</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="<?php echo $this->baseUrl("profile/orderby?get_event_type=bookmarked&sort_by=date"); ?>"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                    <li><a href="<?php echo $this->baseUrl("profile/orderby?get_event_type=bookmarked&sort_by=group_size"); ?>"><img src="<?php echo IMAGES_PATH; ?>/o3.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>
                                <ul class="celebrity-events">

                                    <?php
                                        $__counter = 0;
                                        if (!empty($this->bookmarkedEvents))
                                        {

                                            foreach ($this->bookmarkedEvents as $b_key => $b_value)
                                            {
                                                $event_id = $b_value["event_id"];
                                                $enc_event_id = getEncryptedString($event_id);
                                                $event_title = stripslashes($b_value["event_title"]);
                                                $event_images = getEventImages($event_id);

                                                $event_url = $this->baseUrl("eventdetail/" . getEncryptedString($event_id));
                                                $event_date = getEventDate($b_value["event_date"]);

                                                if ($__counter == 0 || $__counter % 16 == 0)
                                                {
                                                    if ($__counter != 0)
                                                        echo "</ul></div>";

                                                    echo "<div class='bookmarked_page " . ($__counter == 0 ? 'active' : '') . "' id='bookmarked-page-" . (ceil($__counter / 16) + 1) . "'><ul>";
                                                }
                                                ?>
                                                <li id="<?php echo $enc_event_id; ?>">
                                                    <a href="#"><img src="<?php echo $event_images[0]; ?>" alt="<?php echo $event_title; ?>"></a>
                                                    <p class="etitle"><a href="<?php echo $event_url; ?>" class="tlink"><?php echo $event_title; ?></a></p>
                                                    <div class="info">
                                                        <div class="link"><a href="<?php echo $event_url; ?>"><?php echo getUrl($event_url); ?></a></div>
                                                        <div class="date"><?php echo $event_date; ?></div>
                                                        <div class="clock"><?php echo date("g:i a", strtotime($b_value["event_time"])); ?></div>
                                                        <div class="spot"><a href="#" class="remove-bookmark" rel="<?php echo $enc_event_id; ?>">Remove bookmark</a></div>
                                                        <a href="#" class="pin"></a>
                                                </li>
                                                <?php
                                                if (count($this->bookmarkedEvents) - 1 == $b_key)
                                                {
                                                    echo "</ul></div>";
                                                }
                                                $__counter++;
                                            }
                                        }
                                        else
                                        {
                                            echo '<p style="padding:10px; font-size: 12px;">No bookmarked events</p>';
                                        }
                                    ?>
                                </ul>
                                <div class="cf"></div>
                                <p><br /></p>
                                <?php
//                                    if ($__counter != 0):
                                    if ($__counter > 16):
                                        ?>
                                        <!-- Pagination code for created event tab--->
                                        <div class="bottom-main">
                                            <div class="text">You are here:</div>
                                            <ul class="paging client-side bookmarked" data-context ="bookmarked">
                                                <li class="np" data-href="#prev"><a href="#prev">&lt; Prev.</a></li>
                                                <li class="current" data-href="#bookmarked-page-1">
                                                    <span class="first">
                                                        <span class="last">
                                                            <span class="middle">
                                                                Page 1
                                                            </span>
                                                        </span>
                                                    </span>
                                                </li>
                                                <?php
                                                for ($_i = 1; $_i <= ceil($__counter / 16); $_i++)
                                                {

                                                    if ($_i == 1)
                                                        continue;
                                                    ?>
                                                    <li data-href="#bookmarked-page-<?= $_i ?>"><a id="bookmarked-anchor-<?= $_i ?>" href="#bookmarked-page-<?= $_i ?>"><?= $_i ?></a></li>

                                                    <?php
                                                }
                                                ?>
                                                <li class="np" data-href="#next"><a href="#next">Next &gt;</a></li>
                                            </ul>
                                            <div class="cf"></div>
                                        </div>

                                        <!-- pagination ends -->
                                        <?php
                                    endif;
                                ?>
                            </div>
                        </div>
                    </div>
                    <!--</div>-->

                    <div id="account" class="content">
                        <div class="bm-events">
                            <div class="line-ob"><span class="remove-background">Your<strong> Account </strong>Info</span></div>
                        </div>

                        <form name="member-detail-form" id="member-detail-form" action="<?php echo $this->baseUrl("profile/updateprofile"); ?>" method="post">
                            <!--                        <div class="bm-events">
                                                        <div class="line-ob"><span>Your<strong> Account </strong>Info</span></div>
                                                    </div>-->
                            <p><br /></p>
                            <table class="form">
                                <tr>
                                    <td class="t">Username</td>
                                    <td class="i"><div class="il"><div class="ir"><input type="text" name="user_username" value="<?php echo $this->username; ?>" /></div></div></td>
                                </tr>
                                <tr>
                                    <td class="t">E-mail</td>
                                    <td class="i"><div class="il"><div class="ir"><input type="text" name="user_email" value="<?php echo $this->user_email; ?>" /></div></div></td>
                                </tr>
                            </table>
                            <p><br /></p>
                            <div class="iinfo">
                                <div class="iwrap">
                                    <div class="cp-icon fl">

                                    </div>
                                    <div class="fl rside">
                                        <p class="ralign reset-pwd">Reset Password <span class="org">automatically?</span></p>
                                        <table class="form">
                                            <tr>
                                                <td class="t">New Password</td>
                                                <td class="i"><div class="il"><div class="ir"><input type="password" name="new_password" value="" /></div></div></td>
                                            </tr>
                                            <tr>
                                                <td class="t">Retype New Password</td>
                                                <td class="i"><div class="il"><div class="ir"><input type="password" name="confirm_password" value="" /></div></div></td>
                                            </tr>
                                            <tr>
                                                <td class="t">Old Password</td>
                                                <td class="i"><div class="il"><div class="ir"><input type="password" name="old_password" value="" /></div></div></td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </div>
                            <p><br /></p>
                            <table class="form">
                                <tr>
                                    <td class="t">First Name</td>
                                    <td class="i"><div class="il"><div class="ir"><input type="text" name="user_first_name" value="<?php echo $this->first_name; ?>" /></div></div></td>
                                </tr>
                                <tr>
                                    <td class="t">Last Name</td>
                                    <td class="i"><div class="il"><div class="ir"><input type="text" name="user_last_name" value="<?php echo $this->last_name; ?>" /></div></div></td>
                                </tr>
                                <tr>
                                    <td class="t">Gender</td>
                                    <td class="i"><div class="il"><div class="ir">
                                                <?php
                                                    $male_checked = "checked='checked'";
                                                    $female_checked = "";
                                                    $gender = $this->user_gender;
                                                    if ($gender == "m")
                                                    {
                                                        $male_checked = "checked='checked'";
                                                        $female_checked = "";
                                                    }
                                                    else
                                                    {
                                                        $male_checked = "";
                                                        $female_checked = "checked='checked'";
                                                    }
                                                ?>
                                                <input type="radio" name="user_gender" value="m" style="width: 25px; vertical-align: middle;" <?php echo $male_checked; ?>/> Male
                                                <input type="radio" name="user_gender" value="f" style="width: 25px;vertical-align: middle;" <?php echo $female_checked; ?>/> Female
                                            </div></div></td>
                                </tr>
                                <tr>
                                    <td class="t">City/State/Country</td>
                                    <td class="i"><div class="il"><div class="ir"><input type="text" id="address" placeholder="City/State/Country" name="user_location" value="<?php echo $this->user_location; ?>" /></div></div></td>
                                </tr>
<!--                                <tr>
                                    <td class="t">City</td>
                                    <td class="i"><div class="il"><div class="ir"><input type="text" name="user_city" value="<?php echo $this->city; ?>" /></div></div></td>
                                </tr>-->
<!--                                <tr>
                                    <td class="t">Country</td>
                                    <td class="i"><div class="il"><div class="ir">
                                                <input type="text" class="drop" value="USA" />
                                                <select name="user_country" style="width: 306px;">
                                                    <option value="">Please select</option>
                                <?php
                                    foreach ($this->country_records_arr as $country_key => $country_value)
                                    {
                                        $country_selected = "";
                                        if ($country_value["country_id"] == $this->user_country)
                                            $country_selected = 'selected="selected"';

                                        echo '<option value="' . $country_value["country_id"] . '" ' . $country_selected . '>' . $country_value["country_name"] . '</option>';
                                    }
                                ?>
                                                </select>
                                            </div></div></td>
                                </tr>-->
                                <tr class="date_of_birth">
                                    <td class="t">Date of Birth</td>
                                    <td class="i">
                                        <div class="il">
                                            <div class="ir">
                                                <select name="day">
                                                    <option value="">Day</option>
                                                    <?php
                                                        for ($i_day = "1"; $i_day <= "31"; $i_day++)
                                                        {
                                                            $day_selected = '';
                                                            if ($this->birth_day == $i_day)
                                                                $day_selected = 'selected="selected"';

                                                            echo '<option value="' . $i_day . '" ' . $day_selected . '>' . $i_day . '</option>';
                                                        }
                                                    ?>
                                                </select>
                                                <select name="month">
                                                    <option value="">Month</option>
                                                    <?php
                                                        for ($i_month = "1"; $i_month <= "12"; $i_month++)
                                                        {
                                                            $month_selected = '';
                                                            if ($this->birth_month == $i_month)
                                                                $month_selected = 'selected="selected"';

                                                            echo '<option value="' . $i_month . '" ' . $month_selected . '>' . $i_month . '</option>';
                                                        }
                                                    ?>
                                                </select>
                                                <select name="year">
                                                    <option value="">Year</option>
                                                    <?php
                                                        for ($i_year = "1950"; $i_year <= date("Y"); $i_year++)
                                                        {
                                                            $year_selected = '';
                                                            if ($this->birth_year == $i_year)
                                                                $year_selected = 'selected="selected"';

                                                            echo '<option value="' . $i_year . '" ' . $year_selected . '>' . $i_year . '</option>';
                                                        }
                                                    ?>
                                                </select>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="t" style="vertical-align: top;">Info</td>
                                    <td class="i"><div class=""><div class="ir"><textarea class="radius area commbox" name="user_bio" maxlength ="1000"><?php echo $this->user_bio; ?></textarea></div></div></td>
                                </tr>
                                <tr>
                                    <td class="t">Education</td>
                                    <td class="i"><div class="il"><div class="ir"><input type="text" name="user_education" value="<?php echo $this->user_education; ?>" /></div></div></td>
                                </tr>
                                <tr>
                                    <td class="t">Work</td>
                                    <td class="i"><div class="il"><div class="ir"><input type="text" name="user_work" value="<?php echo $this->user_work; ?>" /></div></div></td>
                                </tr>
                            </table>
                            <p><br /><br /><br /><br /></p>
                            <div class="sinfo">
                                <a href="#" class="bluefbutton fr" onclick="$('#member-detail-form').submit();" style="margin-bottom: 20px;">Save</a>
                            </div>
                        </form>
                    </div>

                    <div id="ratings" class="content">
                        <div class="hint">
                            <div class="left fl tab-titles">
                                <ul class="rate-reviews tab-menu-inner">
                                    <li class="active">
                                        <span class="t"><span class="blu"><strong>My Rates</strong></span> Rates and comments I have given to people and events</span>
                                        <div  class="sw ra">
                                            <a href="#rate-tab">&nbsp;</a>
                                        </div>
                                    </li>
                                    <li>
                                        <span class="t"><span class="blu"><strong>My Reviews</strong></span> Rates and comments, that other have given to me</span>
                                        <div  class="sw re">
                                            <a href="#reviews-tab">&nbsp;</a>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                            <div class="fr lst-h">
                                <div class="h active">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span>
                                        Comment more so you could <br />
                                        receive more rates and comments<br />
                                        from your fiends. 
                                    </div>
                                </div>
                                <div class="h">
                                    <div class="hright fr">
                                        <span class="blu"><strong>Hint:</strong></span>
                                        Comment more so you could <br />
                                        receive more rates and comments<br />
                                        from your fiends. 
                                    </div>
                                </div>
                            </div>
                            <div class="cf"></div>
                        </div>
                        <div class="tab-content-list second-tab">
                            <div class="tabs-content rate-tab active content" id="rate-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span class="remove-background"><strong>My Rates</strong> list</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>
                                <ul class="rates-list">
                                    <?php
                                        $model = new Application_Model_Common();
                                        $__counter = 0;
                                        $empty_count = 0;
                                        if (!empty($this->myRatesRecords))
                                        {
                                            foreach ($this->myRatesRecords as $mr_key => $mr_value)
                                            {
                                                $event_id = $mr_value["event_id"];
                                                $enc_event_id = getEncryptedString($event_id);
                                                $event_title = stripslashes($mr_value["event_title"]);
                                                $event_group_size = $mr_value["event_group_size"];
                                                $event_type = ucwords($mr_value["event_type"]);
                                                $event_address = $mr_value["event_address"];
                                                $event_info = stripslashes($mr_value["event_info"]);
                                                $event_category_name = $mr_value["category_name"];
                                                $category_id = $mr_value["category_id"];
                                                $event_subcategory_name = $mr_value["subcategory_name"];
                                                $subcategory_id = $mr_value["subcategory_id"];

                                                $event_date = getEventDate($mr_value["event_date"]);
                                                $event_end_date = getEventDate($mr_value["event_end_date"]);
                                                $event_end_date = strtotime($event_end_date);
                                                $event_time = date("g:i a", strtotime($mr_value["event_time"]));

                                                $event_images = getEventImages($event_id);
                                                $event_link = $this->baseUrl("eventdetail/" . getEncryptedString($event_id));

                                                $show_event_in_my_rates = TRUE;
                                                $event_comment_count_records = $model->getTotalCount("ecm_id", TABLE_EVENT_COMMENTS, "ecm_event_id = $event_id");
//                                                prd($event_comment_count_records);
                                                if ($event_comment_count_records["totalcount"] >= $event_group_size)
                                                {
                                                    $show_event_in_my_rates = FALSE;
                                                }

                                                if (($event_group_size > 20 || empty($event_group_size)) && $event_end_date < time() && $show_event_in_my_rates == TRUE)
                                                {

                                                    if ($__counter == 0 || $__counter % 4 == 0)
                                                    {
                                                        if ($__counter != 0)
                                                            echo "</ul></div>";

                                                        echo "<div class='myrating_page " . ($__counter == 0 ? 'active' : '') . "' id='myrating-page-" . (ceil($__counter / 4) + 1) . "'><ul>";
                                                    }
                                                    ?>
                                                    <li>
                                                        <img src="<?php echo $event_images[0]; ?>" alt="<?php echo $event_title; ?>" class="fl" style="width:73px;height:73px;"/>
                                                        <div class="details fl">
                                                            <div class="e-title">
                                                                <a class="p-name tlink my-rates-event-title" href="<?php echo $event_link; ?>"><?php echo $event_title; ?></a>
                                                                <span class="p-cates">
                                                                    <span>in</span> <a href="<?php echo $this->baseUrl("event/search?cat_search=$category_id"); ?>" class="org tlink"><?php echo $event_category_name; ?></a> / <a class="org tlink" href="<?php echo $this->baseUrl("event/search?cat_search=$subcategory_id"); ?>"><?php echo $event_subcategory_name; ?></a>
                                                                </span>
                                                                <span class="p-time"><?php echo $event_date . " / " . $event_time; ?></span>
                                                            </div>
                                                            <div class="infos">
                                                                <div class="grs">
                                                                    <span class="group org">Group size</span><span> <?php echo $event_group_size; ?></span>
                                                                    <span>&nbsp;&nbsp;/&nbsp;&nbsp;</span><span class="org" style="margin-right: 5px;">Address</span><span><?php echo $event_address; ?></span>
                                                                    <span class="publish fr blu"><a href="#"><?php echo $event_type; ?></a></span>
                                                                </div>
                                                                <div class="cf"></div>
                                                            </div>
                                                            <div class="desc fl">
                                                                <p><?php echo $event_info; ?></p>
                                                            </div>
                                                            <div class="show-rates fr ">
                                                                <a href="#" class="btrates brnd47">Show Rates</a>
                                                            </div>
                                                            <div class="cf"></div>
                                                        </div>
                                                        <ul class="lst-rates">
                                                            <span class="new-comments-here" id="all-comments-<?php echo $event_id;?>">
                                                                <?php
                                                                if (!empty($mr_value["comment_records"]))
                                                                {
                                                                    foreach ($mr_value["comment_records"] as $testKey => $testValue)
                                                                    {
                                                                        ?>
                                                                        <li>
                                                                            <img src="<?php echo getUserImage($mr_value["event_created_by"]); ?>" alt="<?php echo $this->loggedin_full_name; ?>" class="fl" style="width:32px;height:32px;"/>
                                                                            <div class="details fl">
                                                                                <div class="e-title">
                                                                                    <a class="p-name tlink" href="#"><?php echo $this->loggedin_full_name; ?>,</a>
                                                                                </div>
                                                                                <div class="sr">
                                                                                    <span class="fl">RATE:&nbsp;&nbsp;&nbsp;</span> 
                                                                        <!--<span class="rate-star" rel="9"></span>-->
                                                                                    <ul class="profile-stars li-border-padding-none">
                                                                                        <?php
                                                                                        $li_classname = "";
                                                                                        $test_i = 1;
                                                                                        $grey_start_count = 10;
                                                                                        if ($testValue["ecm_ratings"] > 0)
                                                                                        {
                                                                                            $li_classname = "";
                                                                                            $yellow_star_count = $testValue["ecm_ratings"];
                                                                                            $grey_start_count = RATING_STARS_MAX - $yellow_star_count;
                                                                                        }

                                                                                        for ($yellow_i = $yellow_star_count; $yellow_i >= "1"; $yellow_i--)
                                                                                        {
                                                                                            echo '<li class="' . $li_classname . '"><img src="' . IMAGES_PATH . '/star-yellow.png" alt="stars" rel="' . $test_i . '"/></li>';
                                                                                            $test_i++;
                                                                                        }
                                                                                        for ($grey_i = "1"; $grey_i <= $grey_start_count; $grey_i++)
                                                                                        {
                                                                                            echo '<li class="' . $li_classname . '"><img src="' . IMAGES_PATH . '/star-grey.png" alt="stars" rel="' . $test_i . '"/></li>';
                                                                                            $test_i++;
                                                                                        }
                                                                                        ?>
                                                                                    </ul>
                                                                                    <div class="cf"></div>
                                                                                </div>
                                                                                <p><?php echo $testValue["ecm_comment"]; ?></p>
                                                                            </div>
                                                                            <div class="cf"></div>
                                                                        </li>
                                                                        <?php
                                                                    }
                                                                }
                                                                ?>
                                                            </span>
                                                            <li>
                                                                <img src="<?php echo getUserImage($mr_value["event_created_by"]); ?>" alt="<?php echo $this->loggedin_full_name; ?>" class="fl" style="width:32px;height:32px;"/>
                                                                <div class="details fl">
                                                                    <div class="e-title">
                                                                        <a class="p-name tlink" href="#"><?php echo $this->loggedin_full_name; ?>,</a>
                                                                    </div>
                                                                    <div class="sr">
                                                                        <span class="fl">RATE:&nbsp;&nbsp;&nbsp;</span> 
                                                            <!--<span class="rate-star" rel="9"></span>-->
                                                                        <ul class="profile-stars li-border-padding-none" data-clicked="false">
                                                                            <?php
                                                                            $li_classname = " dynamic ";
                                                                            $grey_start_count = RATING_STARS_MAX;
                                                                            for ($grey_i = "1"; $grey_i <= $grey_start_count; $grey_i++)
                                                                            {
                                                                                echo '<li class="' . $li_classname . '" data-grade="' . $grey_i . '"  data-marked="false"  id="' . $grey_i . '"><img src="' . IMAGES_PATH . '/star-grey.png" alt="stars"/></li>';
                                                                            }
                                                                            ?>
                                                                        </ul>
                                                                        <div class="cf"></div>
                                                                    </div>
                                                                    <form class="submit-comment-form">
                                                                        <input type="hidden" name="event_id" value="<?php echo $event_id; ?>"/>
                                                                        <input type="hidden" name="ratings" value="" class="ratings"/>
                                                                        <textarea name="comment" class="comm brnd44 event_comment_text">Write a comment ...</textarea>
                                                                        <p><br /></p>
                                                                        <p><input type="button" value="Send" class="rbox orgbutton event_comment_btn" rel="<?php echo $event_id;?>"/></p>
                                                                    </form>
                                                                </div>
                                                                <div class="cf"></div>
                                                            </li>
                                                        </ul>
                                                        <div class="cf"></div>
                                                    </li>
                                                    <?php
                                                    if (count($this->myRatesRecords) - 1 == $mr_key)
                                                    {
                                                        echo "</ul></div>";
                                                    }
                                                    $__counter++;
                                                }
                                                else
                                                {
//                                                    echo '<p style="padding:10px;">No rates yet.</p>';
                                                    $empty_count++;
                                                }
                                            }
                                        }
                                        else
                                        {
//                                            echo '<p style="padding:10px;">No rates yet.</p>';
                                            $empty_count++;
                                        }
//                                        echo $empty_count." === ".count($this->myRatesRecords);
                                        if ($empty_count >= count($this->myRatesRecords))
                                        {
                                            echo '<p style="padding:10px;">No rates yet.</p>';
                                        }
                                    ?>
                                </ul>
                                <div class="cf"></div>
                                <p><br /></p>
                                <?php
//                                    if ($__counter != 0):
                                    if ($__counter > 4):
                                        ?>
                                        <!-- Pagination code for created event tab--->
                                        <div class="bottom-main">
                                            <div class="text">You are here:</div>
                                            <ul class="paging client-side myrating" data-context ="myrating">
                                                <li class="np" data-href="#prev"><a href="#prev">&lt; Prev.</a></li>
                                                <li class="current" data-href="#myrating-page-1">
                                                    <span class="first">
                                                        <span class="last">
                                                            <span class="middle">
                                                                Page 1
                                                            </span>
                                                        </span>
                                                    </span>
                                                </li>
                                                <?php
                                                for ($_i = 1; $_i <= ceil($__counter / 4); $_i++)
                                                {

                                                    if ($_i == 1)
                                                        continue;
                                                    ?>
                                                    <li data-href="#myrating-page-<?= $_i ?>"><a id="myrating-anchor-<?= $_i ?>" href="#myrating-page-<?= $_i ?>"><?= $_i ?></a></li>

                                                    <?php
                                                }
                                                ?>
                                                <li class="np" data-href="#next"><a href="#next">Next &gt;</a></li>
                                            </ul>
                                            <div class="cf"></div>
                                        </div>

                                        <!-- pagination ends -->
                                        <?php
                                    endif;
                                ?>
                            </div>
                            <div class="tabs-content reviews-tab" id="reviews-tab">
                                <div class="bm-events">
                                    <div class="line-ob"><span class="remove-background"><strong>My Reviews</strong> list</span></div>
                                </div>
                                <ul class="orderby">
                                    <li>Order by:</li>
                                    <li><a href="#"><img src="<?php echo IMAGES_PATH; ?>/o1.png" alt="o1" /></a></li>
                                </ul>
                                <div class="cf"></div>
                                <ul class="reviews-list" style="width: 96%;">
                                    <?php
                                        $__counter = 0;
                                        if (!empty($this->myReviewRecords))
                                        {
                                            foreach ($this->myReviewRecords as $mr_key => $mr_value)
                                            {
                                                $reviewer = $mr_value["user_first_name"] . " " . $mr_value["user_last_name"];
                                                $posted_on = date("d M Y", strtotime($mr_value["ecm_timestamp"]));
                                                $review = trim($mr_value["ecm_comment"]);
                                                $review = stripslashes($review);
                                                $event_title = stripslashes($mr_value["event_title"]);

                                                $yellow_star_count = $mr_value["ecm_ratings"];
                                                $grey_start_count = RATING_STARS_MAX - $yellow_star_count;

                                                if ($__counter == 0 || $__counter % 4 == 0)
                                                {
                                                    if ($__counter != 0)
                                                        echo "</ul></div>";

                                                    echo "<div class='myreview_page " . ($__counter == 0 ? 'active' : '') . "' id='myreview-page-" . (ceil($__counter / 4) + 1) . "'><ul>";
                                                }
                                                ?>
                                                <li>
                                                    <div class="ls fl">
                                                        <div>
                                                            <!--<span class="rate-star" rel="9"></span>-->
                                                            <ul class="profile-stars li-border-padding-none">
                                                                <?php
                                                                for ($yellow_i = $yellow_star_count; $yellow_i >= "1"; $yellow_i--)
                                                                {
                                                                    echo '<li><img src="' . IMAGES_PATH . '/star-yellow.png" alt="stars"/></li>';
                                                                }
                                                                for ($grey_i = "1"; $grey_i <= $grey_start_count; $grey_i++)
                                                                {
                                                                    echo '<li><img src="' . IMAGES_PATH . '/star-grey.png" alt="stars"/></li>';
                                                                }
                                                                ?>
                                                            </ul>
                                                            <div class="cf"></div>
                                                        </div>
                                                        <p class="time">Posted on <span class="blu"><?php echo $posted_on; ?></span></p>
                                                    </div>
                                                    <div class="rs fr">
                                                        <!--<img src="<?php echo IMAGES_PATH; ?>/img21.jpg" alt="<?php echo $reviewer; ?>" class="fr" />-->
                                                        <img src="<?php echo getUserImage($mr_value["user_id"]); ?>" alt="<?php echo $reviewer; ?>" class="fr" width="32" height="32" style="width: 32px;height: 32px;"/>
                                                        <div class="if fr">
                                                            <p>reviewer: <span class="blu n"><?php echo $reviewer; ?></span></p>
                                                            <p>Event: <span class="blu" style="max-width: 198px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;vertical-align: text-bottom;display: inline-block;"><?php echo $event_title; ?></span></p>
                                                        </div>
                                                    </div>
                                                    <div class="cf"></div>
                                                    <div class="rc">
                                                        <p><?php echo $review; ?></p>
                                                    </div>
                                                </li>
                                                <?php
                                                if (count($this->myReviewRecords) - 1 == $mr_key)
                                                {
                                                    echo "</ul></div>";
                                                }
                                                $__counter++;
                                            }
                                        }
                                        else
                                        {
                                            echo '<p style="padding:10px;">No reviews found.</p>';
                                        }
                                    ?>
                                </ul>
                                <div class="cf"></div>
                                <p><br /></p>
                                <?php
//                                    if ($__counter != 0):
                                    if ($__counter > 4):
                                        ?>
                                        <!-- Pagination code for created event tab--->
                                        <div class="bottom-main">
                                            <div class="text">You are here:</div>
                                            <ul class="paging client-side myreview" data-context ="myreview">
                                                <li class="np" data-href="#prev"><a href="#prev">&lt; Prev.</a></li>
                                                <li class="current" data-href="#myreview-page-1">
                                                    <span class="first">
                                                        <span class="last">
                                                            <span class="middle">
                                                                Page 1
                                                            </span>
                                                        </span>
                                                    </span>
                                                </li>
                                                <?php
                                                for ($_i = 1; $_i <= ceil($__counter / 4); $_i++)
                                                {

                                                    if ($_i == 1)
                                                        continue;
                                                    ?>
                                                    <li data-href="#myreview-page-<?= $_i ?>"><a id="myreview-anchor-<?= $_i ?>" href="#myreview-page-<?= $_i ?>"><?= $_i ?></a></li>

                                                    <?php
                                                }
                                                ?>
                                                <li class="np" data-href="#next"><a href="#next">Next &gt;</a></li>
                                            </ul>
                                            <div class="cf"></div>
                                        </div>

                                        <!-- pagination ends -->
                                        <?php
                                    endif;
                                ?>
                            </div>
                            <p><br /><br /></p>
                            <!--                            <div class="bottom-main">
                                                            <div class="text">You are here:</div>
                                                            <ul class="paging">
                                                                <li class="np"><a href="#">&lt; Prev.</a></li>
                                                                <li><a href="#">1</a></li>
                                                                <li>...</li>
                                                                <li><a href="#">5</a></li>
                                                                <li><a href="#">6</a></li>
                                                                <li class="current">
                                                                    <span class="first">
                                                                        <span class="last">
                                                                            <span class="middle">
                                                                                Page 7
                                                                            </span>
                                                                        </span>
                                                                    </span>
                                                                </li>
                                                                <li><a href="#">8</a></li>
                                                                <li><a href="#">9</a></li>
                                                                <li>...</li>
                                                                <li><a href="#">28</a></li>
                                                                <li class="np"><a href="#">Next &gt;</a></li>
                                                            </ul>
                                                            <div class="cf"></div>
                                                        </div>-->
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <div class="right">
            <div class="rtitle">
                Post
            </div>
            <div class="box post-box">
                <a href="<?php echo $this->baseUrl(""); ?>" class="rbox sfebutton"><span class="img"><img src="<?php echo IMAGES_PATH; ?>/adv-icon.png" alt="event" /></span><span>Search for <br/><strong>Events</strong></span></a>
                <a href="<?php echo $this->baseUrl("event"); ?>" class="rbox cebutton"><span class="img"><img src="<?php echo IMAGES_PATH; ?>/event-icon.png" alt="event" /></span><span>Create <strong>Event</strong></span></a>
            </div>
            <div class="rtitle ft-title">
                Friends Tied
            </div>
            <div class="box friend-tied">
                <?php
                    if (!empty($this->friendList))
                    {
                        ?>
                        <ul class="fl">
                            <?php
                            foreach ($this->friendList as $f_key => $f_value)
                            {
                                $friend_user_id = $f_value["user_id"];
                                $friend_user_full_name = $f_value["user_first_name"] . " " . $f_value["user_last_name"];
                                $friend_user_img = getUserImage($friend_user_id);
                                $friend_user_link = getUrl("profile/publicprofile/$friend_user_id");

                                echo '<li><a href="#show-profile-' . $friend_user_id . '" class="show-profile-test" ><img src="' . $friend_user_img . '" alt="' . $friend_user_full_name . '" title="' . $friend_user_full_name . '" class="profile-friend-img"/></a></li>';
                            }
                            ?>
                        </ul>

                        <div class="cf"></div>
                        <?php
                    }
                    else
                    {
                        echo '<div class="view-more">No friends tied yet</div>';
                    }
                ?>
                <div class="cf"></div>
                <div class="view-more">
                    <a href="<?php echo $this->baseurl("friend-list"); ?>" class="tlink blu">View more +</a>
                </div>
            </div>

            <?php
                echo $this->partial("ads.phtml", array("ads_count" => "3"));
            ?>
        </div>
        <div class="cf"></div>
    </div>
</div>




<div class="alert-message pe-upload" id="pe-upload">
    <div class="am-wrapper">
        <a href="#close" class="close-button"></a>
        <div class="title">
            Upload <strong>Image</strong>
        </div>
        <div class="content">
            <div class="browser radius">
                <form name="upload-image" id="upload-image" action="<?php echo $this->baseUrl("profile/uploadimage"); ?>" method="post" enctype="multipart/form-data">
                    <input type="text" class="input" value="Browse" onclick="$(this).next().click();">
                    <input type="file" name="member_img" class="file" onchange="$(this).prev().val($(this).val())" value="">
                    <input type="submit" name="btn_submit" class="upload-button" value="Upload">
                </form>
            </div>
            <p class="note">1MB mx size; JPG, PNG, GIF image formats supported</p>
            <div class="prev">
                <div class="fl">Preview:&nbsp;&nbsp;</div>
                <img src="<?php echo $this->member_image; ?>" alt="<?php echo $this->first_name . " " . $this->last_name; ?>" class="fl upload-preview-image" />
                <div class="cf"></div>
            </div>
            <p><br /></p>
        </div>
    </div>
</div>
<div class="alert-message pe-gellery" id="pe-gellery">
    <div class="am-wrapper">
        <a href="#close" class="close-button"></a>
        <div class="title">
            Quick Ties <strong>Gallery</strong>
        </div>
        <div class="content">
            <p>Choose an image:</p>
            <ul class="gl">
                <?php
                    $files = scandir(GALLERY_IMAGE_PATH);
                    for ($i_image = "2"; $i_image <= count($files) - 1; $i_image++)
                    {
                        ?>
                        <li><a href="<?php echo $this->baseUrl("profile/uploadgalleryprofileimage?image_id=" . $files[$i_image]); ?>"><img src="<?php echo getUrl(GALLERY_IMAGE_PATH . "/" . $files[$i_image]); ?>" alt="img" /><span class="f"></span></a></li>
                        <?php
                    }
                ?>
            </ul>
            <div class="cf"></div>
            <p><br /></p>
            <p><a href="#" class="bluefbutton fr prev">Done</a></p>
            <div class="cf"></div>
        </div>
    </div>
</div>
<div class="alert-message pop-profile pe-facebook" id="pe-facebook">
    <div class="am-wrapper">
        <a href="#close" class="close-button"></a>
        <div class="title">Connect via <strong>Facebook</strong></div>
        <div class="fb-profile">
            <div class="fl">
                <img src="<?php echo IMAGES_PATH; ?>/profile-fb-icon.png" alt="fb icon" />
            </div>
            <div class="fl arr-nxt"><img src="<?php echo IMAGES_PATH; ?>/arrow-next-icon.png" alt="arrow next" /></div>
            <div class="fr">
                <div class="uinfos">
                    <p>Add your <strong>Facebook Username</strong> so </p>
                    <p>friends can identify you!</p>
                    <p><br /></p>
                    <!--<p><input type="text" class="input brnd44 tname" onfocus="this.style.borderColor = '#1996d4'" onblur="this.style.borderColor = '#cfcfcf'" style="border-color: rgb(207, 207, 207);" value=""></p>-->
                    <p><input type="text" class="input brnd44 tname" id="facebook-username" placeholder="Facebook Username" value="<?php echo $this->user_facebook_username; ?>"></p>
                    <div class="conn-fb">
                        <a class="updateSocialUsername" href="#" rel="facebook"><img src="<?php echo IMAGES_PATH; ?>/bg-connectfb.png" alt="conn fb" /></a>
                    </div>
                </div>
            </div>
            <div class="cf"></div>
        </div>

    </div>
</div>
<div class="alert-message pop-profile pe-facebook" id="pe-twitter">
    <div class="am-wrapper">
        <a href="#close" class="close-button"></a>
        <div class="title">Connect via <strong>Twitter</strong></div>
        <div class="fb-profile">
            <div class="fl">
                <img src="<?php echo IMAGES_PATH; ?>/profile-tw-icon.png" alt="fb icon" />
            </div>
            <div class="fl arr-nxt"><img src="<?php echo IMAGES_PATH; ?>/arrow-next-icon.png" alt="arrow next" /></div>
            <div class="fr">
                <div class="uinfos">
                    <p>Add your <strong>Twitter Username</strong> so </p>
                    <p>friends can identify you!</p>
                    <p><br /></p>
                    <!--<p><input type="text" class="input brnd44 tname" onfocus="this.style.borderColor = '#1996d4'" onblur="this.style.borderColor = '#cfcfcf'" style="border-color: rgb(207, 207, 207);" value=""></p>-->
                    <p><input type="text" class="input brnd44 tname" id="twitter-username" placeholder="Twitter Username" value="<?php echo $this->user_twitter_username; ?>"></p>
                    <div class="conn-fb">
                        <a class="updateSocialUsername" href="#" rel="twitter"><img src="<?php echo IMAGES_PATH; ?>/bg-connecttw.png" alt="conn twitter" /></a>
                    </div>
                </div>
            </div>
            <div class="cf"></div>
        </div>

    </div>
</div>
<div class="alert-message pop-profile pe-facebook" id="pe-linked">
    <div class="am-wrapper">
        <a href="#close" class="close-button"></a>
        <div class="title">Connect via <strong>Linkedin</strong></div>
        <div class="fb-profile">
            <div class="fl">
                <img src="<?php echo IMAGES_PATH; ?>/profile-linked-icon.png" alt="fb icon" />
            </div>
            <div class="fl arr-nxt"><img src="<?php echo IMAGES_PATH; ?>/arrow-next-icon.png" alt="arrow next" /></div>
            <div class="fr">
                <div class="uinfos">
                    <p>Add your <strong>Linkedin Username</strong> so </p>
                    <p>friends can identify you!</p>
                    <p><br /></p>
                    <!--<p><input type="text" class="input brnd44 tname" onfocus="this.style.borderColor = '#1996d4'" onblur="this.style.borderColor = '#cfcfcf'" style="border-color: rgb(207, 207, 207);" value=""></p>-->
                    <p><input type="text" class="input brnd44 tname" id="linkedin-username" placeholder="LinkedIn Username" value="<?php echo $this->user_linkedin_username; ?>"></p>
                    <div class="conn-fb">
                        <a class="updateSocialUsername" href="#" rel="linkedin"><img src="<?php echo IMAGES_PATH; ?>/bg-connectl.png" alt="conn linkedin" /></a>
                    </div>
                </div>
            </div>
            <div class="cf"></div>
        </div>

    </div>
</div>
<?php
    $this->getHelper('Profile')->init($this->user_id, TRUE);
    //echo $this->partialLoop('profilepopup.phtml', $this->friendGroupsAndFriends);
?>

<script>
                                    $(document).ready(function() {
                                        $(".remove-bookmark").live("click", function(event) {
                                            event.preventDefault();
                                            var event_id = $(this).attr("rel");
                                            $.ajax({
                                                type: "POST",
                                                url: "<?php echo $this->baseUrl("ajax/bookmarkevent"); ?>",
                                                data: {"event_id": event_id},
                                                success: function(response) {
                                                    $("li#" + event_id).remove();
                                                }
                                            });
                                        });

                                        $(".leave-joined").click(function(event) {
                                            event.preventDefault();
                                            var href = $(this).attr("href");
                                            ConfirmLeaveEvent("Leave Event", "Are you sure to leave event?", href, $(this).attr("rel"));
                                        });

                                        $(".delete-event").click(function(event) {
                                            event.preventDefault();
                                            var href = $(this).attr("href");
                                            ConfirmDeleteEvent("Delete Event", "Are you sure to delete this event?", href, $(this).attr("rel"));
                                        });

                                        $(".event_comment_btn").click(function() {
                                            var event_id=$(this).attr('rel');
                                            var form_serialize = $(this).parent().parent().parent().find('.submit-comment-form').serialize();
//                                            console.log(form_serialize);
                                            $.ajax({
                                                type: "POST",
                                                data: form_serialize,
                                                url: "<?php echo $this->baseUrl('profile/addeventcomment'); ?>",
                                                success: function(response) {
                                                    $(".lst-rates").slideUp();

                                                    if (response != "")
                                                    {
                                                        $('#all-comments-'+event_id).append(response);
                                                        
                                                        $('form.submit-comment-form textarea').val('Write a comment ...');
                                                        $('form.submit-comment-form input.ratings').val('0');
                                                    }
                                                }
                                            });
                                        });
                                    });
</script>